-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[CIR][CIRGen][Builtin][X86] Multishift Intrinsics #169618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Added builtin support for the multishift operation with test file. changes has been done in CIRGenBuiltinX86 file
|
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
|
@llvm/pr-subscribers-clangir @llvm/pr-subscribers-clang Author: Omkar Rasal (cs25mtech12008) ChangesAdded builtin support for the multishift operation with test file. changes has been done in CIRGenBuiltinX86 file Full diff: https://github.com/llvm/llvm-project/pull/169618.diff 2 Files Affected:
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
index e7aa8a234efd9..4cbeecf0d8ea3 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
@@ -877,9 +877,16 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID,
case X86::BI__builtin_ia32_vp2intersect_d_512:
case X86::BI__builtin_ia32_vp2intersect_d_256:
case X86::BI__builtin_ia32_vp2intersect_d_128:
+ cgm.errorNYI(expr->getSourceRange(),
+ std::string("unimplemented X86 builtin call: ") +
+ getContext().BuiltinInfo.getName(builtinID));
+ return {};
case X86::BI__builtin_ia32_vpmultishiftqb128:
+ return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_128", ops[0].getType(), ops);
case X86::BI__builtin_ia32_vpmultishiftqb256:
+ return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_256", ops[0].getType(), ops);
case X86::BI__builtin_ia32_vpmultishiftqb512:
+ return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_512", ops[0].getType(), ops);
case X86::BI__builtin_ia32_vpshufbitqmb128_mask:
case X86::BI__builtin_ia32_vpshufbitqmb256_mask:
case X86::BI__builtin_ia32_vpshufbitqmb512_mask:
diff --git a/clang/test/CIR/CodeGen/X86/builtin_multishift.c b/clang/test/CIR/CodeGen/X86/builtin_multishift.c
new file mode 100644
index 0000000000000..7c57ef3191d1d
--- /dev/null
+++ b/clang/test/CIR/CodeGen/X86/builtin_multishift.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512vbmi \
+// RUN: -fclangir -emit-cir %s -o - | FileCheck %s
+
+#include <immintrin.h>
+__m512i test_multishift(__m512i x, __m512i y) {
+ return _mm512_multishift_epi64_epi8(x, y);
+}
+
+// // CHECK: cir.func @test_multishift
+// // CHECK: cir.call @__builtin_ia32_vpmultishiftqb512
+
|
andykaylor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch! I have just a couple of requests for changes.
| getContext().BuiltinInfo.getName(builtinID)); | ||
| return {}; | ||
| case X86::BI__builtin_ia32_vpmultishiftqb128: | ||
| return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_128", ops[0].getType(), ops); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return emitIntrinsicCallOp(*this, expr, "x86_avx512_pmultishift_qb_128", ops[0].getType(), ops); | |
| return emitIntrinsicCallOp(builder, getLoc(expr->getExprLoc()), "x86_avx512_pmultishift_qb_128", ops[0].getType(), ops); |
You'll need to rebase your PR to get this new signature. It's been updated recently.
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512vbmi \ | ||
| // RUN: -fclangir -emit-cir %s -o - | FileCheck %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512vbmi \ | |
| // RUN: -fclangir -emit-cir %s -o - | FileCheck %s | |
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512vbmi -fclangir -emit-cir %s -o %t.cir | |
| // RUN: FileCheck --input-file=%t.cir --check-prefix=CIR %s | |
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512vbmi -fclangir -emit-llvm %s -o %t-cir.ll | |
| // RUN: FileCheck --input-file=%t-cir.ll --check-prefix=LLVM %s | |
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +avx512vbmi -emit-llvm %s -o %t.ll | |
| // RUN: FileCheck --input-file=%t.ll --check-prefix=OGCG %s |
These lines perform the three variations of checks we expect.
However, this test should be moved to clang/test/CIR/CodeGenBuiltins/X86/avx512vbmi-builtins.c which is also being added in #169582
Added builtin support for the multishift operation with test file.
changes has been done in CIRGenBuiltinX86 file
please review the changes and suggest if anything is missing